package com.study.notepad.service.impl;


import com.study.notepad.bean.Note;
import com.study.notepad.dao.NoteDao;
import com.study.notepad.service.NoteService;
import com.study.notepad.util.PageUtil;

import java.util.List;

public class NoteServiceImpl implements NoteService {

    private NoteDao noteDao = new NoteDao();

    @Override
    public List<Note> queryByUserId(Integer userId, PageUtil pageUtil) {
        return noteDao.queryByUserId(userId, pageUtil);
    }

    @Override
    public Integer saveNote(Integer userId, String title, String content) {
        return noteDao.insert(userId, title, content);
    }

    @Override
    public Integer deleteById(Integer id) {
        return noteDao.deleteById(id);
    }

    @Override
    public Integer updateById(Integer id, String title, String content) {
        return noteDao.updateById(id, title, content);
    }

    @Override
    public Note queryById(int id) {
        return noteDao.queryById(id);
    }

    @Override
    public Integer totalNum(Integer userId) {
        return noteDao.totalNum(userId);
    }
}
